package com.xbb.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xbb.entity.Role;
import com.xbb.entity.Rolemodules;
import org.apache.ibatis.annotations.Select;

import javax.validation.Valid;
import java.util.List;

public interface RoleMapper extends BaseMapper<Role> {

    //根据name获取角色名--验证角色添加
    @Select("select name from roles where name = #{name}")
    List<Role> getRoleName(@Valid Role role);

    //根据角色id获取rolemodules信息--验证角色删除
    @Select("select * from rolemodules where role_id=#{id}")
    List<Rolemodules> getRolesContainsMod(Integer id);
}
